<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <c:set var="ctx" value="${pageContext.request.contextPath}"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>小贷业务上报详情</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
<div class="Wrapper">
    <div id="pageInTab" class="pageInTab">
        <div class="searchArea">
            <form id="searchBar">
                <div class="fieldset1 clearFix">
                    <div class="fieldBox">
                        <div class="label">支付表号</div>
                        <div class="field">
                            <input name="busSourceId" id="busSourceId" type="text" class="ui-textbox" value="">
                        </div>
                    </div>
                    <div class="fieldBox">
                        <div class="label">机构名称</div>
                        <div class="field">
                            <input name="fundNm" id="fundNm" type="text" class="ui-textbox" value="">
                        </div>
                    </div>
                    <div class="fieldBox">
                        <div class="label">-事业部-</div>
                        <div class="field">
                            <select name="prjOrg" id="prjOrg">
                                <option value="" seleted>-请选择-</option>
                                <c:forEach items="${orgListList }" var="org">
                                    <option value="${org.key }">${org.value }</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>

                    <div class="fieldBox col_33" >
                        <div class="label">机构放款时间</div>
                        <div class="field">
                            <input name="startTm" id="startTm" type="text" class="ui-datepicker" value="">
                            <span>-</span>
                            <input name="endTm" id="endTm" type="text" class="ui-datepicker" value="">
                        </div>
                    </div>

                    <div class="fieldBox">
                        <div class="label">项目类型</div>
                        <div class="field">
                            <select name="prjType"  id="prjType" >
                                <option value="" selected="selected">-请选择-</option>
                                <c:forEach items="${projectTypeList}" var="opt">
                                    <option value="${opt.key}">${opt.value}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>

                    <div class="fieldBox col_33" >
                        <div class="label">逾期天数</div>
                        <div class="field">
                            <input ligerui="width: 82" name="overdueDayMin" id="overdueDayMin" type="text" class="ui-textbox" value="">
                            <span>-</span>
                            <input ligerui="width: 82" name="overdueDayMax" id="overdueDayMax" type="text" class="ui-textbox" value="">
                        </div>
                    </div>

                    <div class="fieldBox col_33" >
                        <div class="label">费率%</div>
                        <div class="field">
                            <input ligerui="width: 82" name="guaranteeRateMin" id="guaranteeRateMin" type="text" class="ui-textbox" value="">
                            <span>-</span>
                            <input ligerui="width: 82" name="guaranteeRateMax" id="guaranteeRateMax" type="text" class="ui-textbox" value="">
                        </div>
                    </div>

                    <div class="fieldBox" id="searchPrjTypCdId">
                        <div class="label">上报类型</div>
                        <div class="field">
                            <select name="isRisk"  id="isRisk" >
                                <option value=""  selected="selected">-请选择-</option>
                                <option value="2" >风险上报</option>
                                <option value="1">非风险上报</option>
                            </select>
                        </div>
                    </div>

                    <div class="clearFix"></div>
                    <div class="btnsBox">
                        <span id="searchBtn"  class="sq-button sq-button-round">查询</span>
                        <span id="clearBtn"  class="sq-button sq-button-round">清空</span>
                    </div>
                </div>
            </form>
        </div>
        <div class="sqPanel_body">
            <div id="ligergrid1" class="sq-grid"></div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    var grid = null;
    var pageInApp = {}; // to 下一级子窗口 接口
    var pageInTab = null;
    $(function () {
        var _url = '<%=path%>/fgi/fgibusinfo/initList.do?isSub=1&busSourceType=' + ${busSourceType};
        $("#ligergrid1").ligerGrid({
            url: _url,
            //parms:{},
            method: 'get',
            columns: [
                { display: '上报时间/更新时间', name: 'subTm', minWidth: 150 , render:renderDate, enabledSort:true},
                { display: '上报状态', name: 'isSub', minWidth: 100 , enabledSort:true,
                    render: function (rowdata, rowindex, value, column) {
                        if (rowdata.isSub == 1) {
                            return "上报成功";
                        } else if (rowdata.isSub == -1) {
                            return "上报失败";
                        }else if (rowdata.isSub == 2) {
                            return "上报中";
                        }
                    }
                },
                { display: '支付表号', name: 'busSourceId', minWidth: 180 , enabledSort:true,
                    render: function (rowdata, rowindex, value, column){
                        var h='<a href="javascript:showDetail(';
                        h+="'"+rowdata.busSourceId+"'";
                        h+=')">'+rowdata.busSourceId+'</a>';
                        return h;
                    }
                },
                { display: '客户', name: 'cstNm', minWidth: 100,align:'center', enabledSort:true},
                { display: '是否资管业务', name: 'isCap', minWidth: 100 , enabledSort:true,
                    render: function (rowdata, rowindex, value, column) {
                        if (rowdata.isCap == 1) {
                            return "是";
                        } else if (rowdata.isCap == 0) {
                            return "否";
                        }
                    }
                },
                { display: '上报类型', name: 'isRisk', minWidth: 100 , enabledSort:true,
                    render: function (rowdata, rowindex, value, column) {
                        if (rowdata.isRisk == 2) {
                            return "风险上报";
                        } else if (rowdata.isRisk == 1) {
                            return "非风险上报";
                        }
                    }
                },
                { display: '机构名称', name: 'fundNm', minWidth: 150 , enabledSort:true},
                { display: '机构实际付款时间', name: 'createTime', minWidth: 150 , enabledSort:true},
                /*{ display: '系统支付表状态', name: 'guaranteeStatus', minWidth: 150 , enabledSort:true},*/
                { display: '担保类型', name: 'guaranteeType', minWidth: 100 , enabledSort:true},
                { display: '合同担保金额(元)', name: 'guaranteeMoney', minWidth: 100 , enabledSort:true},
                { display: '担保余额(元)', name: 'guaranteeSurplusMoney', minWidth: 100 , enabledSort:true},
                { display: '逾期天数(天)', name: 'overdueDay', minWidth: 100,align:'center', enabledSort:true},
                { display: '分担比例', name: 'shareProportion', minWidth: 100 , enabledSort:true},
                { display: '费率', name: 'guaranteeRate', minWidth: 100 , enabledSort:true},
                { display: '融资用途', name: 'financePurpose', minWidth: 100 , enabledSort:true},
                { display: '担保开始日期', name: 'startTime', minWidth: 150 , enabledSort:true},
                { display: '担保结束日期', name: 'endTime', minWidth: 150 , enabledSort:true},
                { display: '是否农民', name: 'isAgriculture', minWidth: 100 , enabledSort:true,
                    render: function (rowdata, rowindex, value, column) {
                        if (rowdata.isAgriculture == 1) {
                            return "是";
                        } else if (rowdata.isAgriculture == 0) {
                            return "否";
                        }
                    }
                },
                { display: '创建时间', name: 'createTime', minWidth: 150 , enabledSort:true},
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            checkbox: true,
            fixedCellHeight: false,
            rownumbers: true,
//			onAfterShowData: getFlowIds,
        });
        grid = liger.get("ligergrid1");
        grid.setHeight(100);
        $("#searchBar").ligerForm();
        $('#reasonFromSet').ligerForm({
            validate: true
        });

        $("#searchBtn").click(function (event) {
            var form = new liger.get("searchBar");
            var data = form.getData();
            console.log(JSON.stringify(data));
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            ;
            grid.reload();
        });
        $("#clearBtn").click(function (event) {
            $("#resetBtn").click();  //重置 input-text
            var form = liger.get("searchBar");
            form.setData({  //重置select等特殊表单
                "busSourceId": " ",
                "fundNm": " ",
                "prjOrg": " ",
                "startTm": " ",
                "endTm": " ",
                "prjType": " ",
                "overdueDayMin": " ",
                "overdueDayMax": " ",
                "guaranteeRateMin": " ",
                "guaranteeRateMax": " ",
                "isRisk": " ",
            });
        });
    });

    //上报数据详情详情
    function showDetail(busSourceId){
        if(!busSourceId)return;
        Add_navTab('showDetail'+busSourceId + '_2_2001','上报数据详情详情','<%=path%>/fgi/fgibusinfo/toSubmitDetailPage.do?busSourceId=' + busSourceId + '&busSource=2&busSourceType=2001');
    }

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }

</script>
</html>